"""
逾期率Job执行模块
"""
import unittest
import requests
from cookie import login


header = {'cookie': login.Logins(),
          'Host': 'ssopre.cnsuning.com',
          'Referer': 'http://plsadmpre.cnsuning.com/plsadm/open/intf/test/openIntfTest.do'}


# 逾期率job接口
class Rxd_Job_Case(unittest.TestCase):

    def setUp(self):
        self.base_url = 'http://plsadmPre.cnsuning.com/plsadm/loan/test/job.do'

    def tearDown(self):
        print(self.result)

    """job执行成功"""
    def test_lyql_job(self):
        paydata = ''
        r = requests.post(url=self.base_url, data=paydata, headers=header)
        self.result = r.json()
        if len(str(self.result)) > 50:
            result = eval(self.result['result'])
            self.assertEqual(result["status"], '01')
        else:
            self.assertEqual(self.result["result"], '成功')


if __name__ == '__main__':
    unittest.main()
